﻿package org.openChart.sprite 
{
	import flash.display.Sprite;
	import org.openChart.display.DisplayStick;
	
	/**
	 * ...
	 * 
	 * @author Chongyuan
	 */
	public class StickSprite extends BaseSprite
	{
		//public var stick:DisplayStick;
		public function StickSprite(stick:DisplayStick, commandHandler:CommandHandler) 
		{
			super(stick, commandHandler);
			//trace(stick.showLine);
			if (stick.showLine)
			{
				var stickLine:StickLineSprite = new StickLineSprite(stick.stickLine, null);
				this.addChild(stickLine);
			}
		}
		
		public override function paint():void
		{
			var stick:DisplayStick = displayObject as DisplayStick;
			
			this.graphics.lineStyle(stick.width, stick.color, 1.0);
			this.graphics.moveTo(stick.startPosition.x, stick.startPosition.y);
			this.graphics.lineTo(stick.endPosition.x, stick.endPosition.y);
			this.graphics.endFill();
		}
		
	}
	
}